﻿package 
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	/**
	 * ...
	 * @author DarkGoodWIN
	 */
	public class Main extends MovieClip
	{
		private var MainControl: TControl = null;
		private var GameInfo: TNaperstokInfo = null;
		
		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function FillFlashVars(): Object
		{
			var flashVars: Object = stage.loaderInfo.parameters as Object; 
        	if (!flashVars.api_id) 
			{
              // -- For local testing enter you test-code here:
              flashVars['api_id'] = 1933179;
              flashVars['viewer_id'] = 4652534;
              flashVars['sid'] = "a9245787dba252b862f3dbd17cb501715404412461f79de9a336c1f00b4d9c";
              flashVars['secret'] = "98f43df4f4";
			 
              // -- //
            }		
			return flashVars;
		}
				
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			MainControl = new TControl(this);
			TModalWindow.Parent = MainControl;
			
			var MainRect: Trect = new Trect(MainControl, 0xFFDAB9, 0, 0, 560, 500, false, false, true);
			MainRect.Ctrl.alpha = 0.6;
			
			var FriendsRect: Trect = new Trect(MainControl, 0x98FB98, 0, 500, 800, 100, false, true, true);
			FriendsRect.Ctrl.alpha = 0.5;
			//new Trect(MainControl, 0xAABBCC, 0, 300, 560, 200);
			
			//FillFlashVars();
			GameInfo = new TNaperstokInfo(FillFlashVars());
											
			GameInfo.GreateControls(MainControl);
		}
		
	}
	
}